<extend name="Public/layout"/>
<block name="head">
<link rel="stylesheet" href="__PUBLIC__css/ceping-details.css">
        <style type="text/css">
        .footer{
            display: none;
        }
        </style>
<script src="__PUBLIC__assets/ckplayer/ckplayer.js"></script>
</block>
<block name="main">
    <div class="tabs">
        <ul class="list-wrapper">
            <li class="list-item <if condition='$_GET[cate_id] eq 1'>active </if>" onclick="change_video(1)">实地走访</li>
            <li class="list-item <if condition='$_GET[cate_id] eq 2'>active </if>" onclick="change_video(2)">高管答疑</li>
            <li class="list-item <if condition='$_GET[cate_id] eq 3'>active </if>" onclick="change_video(3)">8号测评</li>
            <li class="list-item <if condition='$_GET[cate_id] eq 4'>active </if>" onclick="change_video(4)">运营跟踪</li>
        </ul>
    </div>
    <div class="content">
        <!--实地走访-->
        <div class="content-item">

            <if condition='$_GET[cate_id] eq 1 || !$_GET[cate_id]'>
                <notempty name="video.pic">
                    <div class="video-wrapper">
                        <div id="a1" pic="{$video.pic}" video_id="{$video.video_id}" info_id="{$video.id}" video="{$video.hd_url}"></div>
                    </div>
                </notempty>

                <div class="centent-body">
                    <h3>{$plat.name}实地走访</h3>
                    <div class="content-text-wrapper">
                        <div class="content contentWrapper clearfix">
                            <notempty name="news.content">
                                {$news.content}
                                <else/>
                                <p>测评正在路上敬请期待！</p>
                            </notempty>
                        </div>
                        <div class="unfold-field">
                            <div class="unflod-field_mask"></div>
                            <div class="unfold-field_text"><span>展开全文</span></div>
                        </div>
                    </div>
                    <if condition="$videodata_count gt 1">
                        <div class="content-video-wrapper">
                            <h5>相关视频</h5>
                            <ul class="list-wrapper">
                                <foreach name="videodata" item="v">
                                        <li class="list-item">
                                            <a href="{:U('Video/appraisal_info',array('p_id'=>$v[platform_id],'v_id'=>$v[video][id],'cate_id'=>$v[cate_id]))}">
                                                <div class="item-left">
                                                    <img src="{$v.video.pic}" alt="">
                                                </div>
                                                <div class="item-right">
                                                    <p class="title">{$v.video.title}</p>
                                                    <p class="author">发布日期：{:date('Y-m-d',$v[video][add_time])}</p>
                                                    <p class="desc">
                                                        <span class="duration"></span>
                                                        <span class="play-count">播放：{$v.video.play_amount_z}</span>
                                                    </p>
                                                </div>
                                            </a>
                                        </li>
                                </foreach>
                            </ul>
                        </div>
                    </if>
                </div>
            </if>
            <if condition='$_GET[cate_id] eq 2'>
                <notempty name="video.pic">
                    <div class="video-wrapper">
                        <div id="a1" pic="{$video.pic}" video_id="{$video.video_id}" info_id="{$video.id}" video="{$video.hd_url}"></div>
                    </div>
                </notempty>
                <div class="centent-body">
                    <h3>{$plat.name}高管答疑</h3>
                    <div class="content-text-wrapper">
                        <div class="content contentWrapper clearfix">
                            <notempty name="news.content">
                                {$news.content}
                                <else/>
                                <p>测评正在路上敬请期待！</p>
                            </notempty>
                        </div>
                        <div class="unfold-field">
                            <div class="unflod-field_mask"></div>
                            <div class="unfold-field_text"><span>展开全文</span></div>
                        </div>
                    </div>
                   <if condition="$videodata_count gt 1">
                        <div class="content-video-wrapper">
                            <h5>相关视频</h5>
                            <ul class="list-wrapper">
                                <foreach name="videodata" item="v">
                                        <li class="list-item">
                                            <a href="{:U('Video/appraisal_info',array('p_id'=>$v[platform_id],'v_id'=>$v[video][id],'cate_id'=>$v[cate_id]))}">
                                                <div class="item-left">
                                                    <img src="{$v.video.pic}" alt="">
                                                </div>
                                                <div class="item-right">
                                                    <p class="title">{$v.video.title}</p>
                                                    <p class="author">发布日期：{:date('Y-m-d',$v[video][add_time])}</p>
                                                    <p class="desc">
                                                        <span class="duration"></span>
                                                        <span class="play-count">播放：{$v.video.play_amount_z}</span>
                                                    </p>
                                                </div>
                                            </a>
                                        </li>
                                </foreach>
                            </ul>
                        </div>
                    </if>
                </div>
            </if>
            <if condition='$_GET[cate_id] eq 3'>
                <notempty name="video.pic">
                    <div class="video-wrapper">
                        <div id="a1" pic="{$video.pic}" video_id="{$video.video_id}" info_id="{$video.id}" video="{$video.hd_url}"></div>
                    </div>
                </notempty>
                <div class="centent-body">
                    <h3>{$plat.name}8号测评</h3>
                    <div class="content-text-wrapper">
                        <div class="content contentWrapper clearfix">
                            <notempty name="news.content">
                                {$news.content}
                                <else/>
                                <p>测评正在路上敬请期待！</p>
                            </notempty>
                        </div>
                        <div class="unfold-field">
                            <div class="unflod-field_mask"></div>
                            <div class="unfold-field_text"><span>展开全文</span></div>
                        </div>
                    </div>
                    <if condition="$videodata_count gt 1">
                        <div class="content-video-wrapper">
                            <h5>相关视频</h5>
                            <ul class="list-wrapper">
                                <foreach name="videodata" item="v">
                                    <li class="list-item">
                                        <a href="{:U('Video/appraisal_info',array('p_id'=>$v[platform_id],'v_id'=>$v[video][id],'cate_id'=>$v[cate_id]))}">
                                            <div class="item-left">
                                                <img src="{$v.video.pic}" alt="">
                                            </div>
                                            <div class="item-right">
                                                <p class="title">{$v.video.title}</p>
                                                <p class="author">发布日期：{:date('Y-m-d',$v[video][add_time])}</p>
                                                <p class="desc">
                                                    <span class="duration"></span>
                                                    <span class="play-count">播放：{$v.video.play_amount_z}</span>
                                                </p>
                                            </div>
                                        </a>
                                    </li>
                                </foreach>
                            </ul>
                        </div>
                    </if>
                </div>
            </if>
            <if condition='$_GET[cate_id] eq 4'>
                <notempty name="video.pic">
                    <div class="video-wrapper">
                        <div id="a1" pic="{$video.pic}" video_id="{$video.video_id}" info_id="{$video.id}" video="{$video.hd_url}"></div>
                    </div>
                </notempty>
                <div class="centent-body">
                    <h3>{$plat.name}运营跟踪</h3>
                    <div class="content-text-wrapper">
                        <div class="content contentWrapper clearfix">
                            <notempty name="news.content">
                                {$news.content}
                                <else/>
                                <p>测评正在路上敬请期待！</p>
                            </notempty>
                        </div>
                        <div class="unfold-field">
                            <div class="unflod-field_mask"></div>
                            <div class="unfold-field_text"><span>展开全文</span></div>
                        </div>
                    </div>

                    <if condition="$videodata_count gt 1">
                        <div class="content-video-wrapper">
                            <h5>相关视频</h5>
                            <ul class="list-wrapper">
                                <foreach name="videodata" item="v">
                                    <li class="list-item">
                                        <a href="{:U('Video/appraisal_info',array('p_id'=>$v[platform_id],'v_id'=>$v[video][id],'cate_id'=>$v[cate_id]))}">
                                            <div class="item-left">
                                                <img src="{$v.video.pic}" alt="">
                                            </div>
                                            <div class="item-right">
                                                <p class="title">{$v.video.title}</p>
                                                <p class="author">发布日期：{:date('Y-m-d',$v[video][add_time])}</p>
                                                <p class="desc">
                                                    <span class="duration"></span>
                                                    <span class="play-count">播放：{$v.video.play_amount_z}</span>
                                                </p>
                                            </div>
                                        </a>
                                    </li>
                                </foreach>
                            </ul>
                        </div>
                    </if>
                </div>
            </if>
        </div>

    </div>

<!--底部-->
</block>
<block name="js">
<!-- <script src="__PUBLIC__js/ceping-details.js"></script> -->

    <script>
        window.onload=function(){
            var unfoldField=document.querySelector(".unfold-field");
            var wrapH=document.querySelector(".content-text-wrapper").offsetHeight;
            var wrap=document.querySelector(".content-text-wrapper");
            var contentH=document.querySelector(".contentWrapper").offsetHeight;
            var videoWrapper = document.querySelector(".content-video-wrapper")
// 如果实际高度大于我们设置的默认高度就把超出的部分隐藏。
            if (contentH > wrapH){
                unfoldField.style.display="block";
            } else {
                unfoldField.style.display="none";
            }
            if (!videoWrapper) {
                unfoldField.style.display="none";
                wrap.style.maxHeight="100%";
                wrap.style.visibility="visible";
            }
            wrap.style.visibility="visible";
            unfoldField.onclick=function(){
                this.parentNode.removeChild(this);
                wrap.style.maxHeight="100%";
                wrap.style.visible="visible";
            }
        }
    </script>

    <script type="text/javascript">
	
			var res = $('.content-text-wrapper').find('img');
			console.log(res);
		$(res).each(function(i,v){
			var old = $(v).attr('src')
			new_src = "http://manage.8hjie.com"+old
			$(res[i]).attr('src',new_src)
			console.log(res[i])
		})
	
		
        var currentVideoId = $('.content').find('.video-wrapper>div').attr('id');
        var currentVideoPic = $('.content').find('.video-wrapper>div').attr('pic');
        var currentVideoVideo = $('.content').find('.video-wrapper>div').attr('video');
        var video_id = $('.content').find('.video-wrapper>div').attr('video_id');
        var info_id = $('.content').find('.video-wrapper>div').attr('info_id');

        oldVideoId = currentVideoId;
        //  function playVideo(pic,video) {
        var videoId = 'ckplayer_a1'
        var clientWidth = document.documentElement.clientWidth;
        var videoHeight = clientWidth / 16 * 9;
        var flashvars = {
            i: currentVideoPic,
            c: 0,
            p: 0,
            loaded:'loadedHandler'
        };
        var video = [currentVideoVideo];
        CKobject.embed('ckplayer/ckplayer.swf', 'a1', videoId, '100%', videoHeight, false, flashvars, video);
        function loadedHandler(){
            CKobject.getObjectById('ckplayer_a1').addListener('ended',playHandler); 
            CKobject.getObjectById('ckplayer_a1').addListener('play',addplay);
        
        }
        function playHandler(){
            loop=false
        }

        function addplay(){
            //监听播放事件  添加播放量
            $('.aside_[id] li').eq(0).find('.click-num').html('<i class="iconfont icon-v"></i>')
                $.post("{:U('Video/play_count')}",{
                    id:video_id,
                    info_id:info_id,
                },function(res){
                    //console.log(res)
//                    console.log("开始播放视频")
            })
        }


        //   }
        function change_video(val) {
            var p_id = "{$_GET['p_id']}"
            var a_id = "{$_GET['a_id']}"
            if (p_id) {

                location.href = "/Home/Video/appraisal_info/p_id/" + p_id + "/cate_id/" + val
            }
            if (a_id) {
                location.href = "/Home/Video/appraisal_info/a_id/" + a_id + "/cate_id/" + val
            }
        }



    </script>
</block>